package com.un.ebs.core;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.un.ebs.core.enums.IndustryTypeEnum;
import com.un.ebs.core.enums.UserTypeEnum;
import com.un.ebs.core.util.SecurityUtils;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 用户上下文
 * @email 496382223@qq.com
 * @author:Lijj
 * @date: 2019/9/4
 */
@Data
public class UserContext implements Serializable {

    private String id;

    private String userName;

    @JsonIgnore
    private String password;

    /**
     * 0 平台管理员
     * 1 开发者
     * 2 一般用户
     */
    private UserTypeEnum type;

    private String wxOpenId;

    private String wxHeadImgUrl;

    private String wxSexDesc;

    private String wxNickname;

    private String wxUnionId;

    private String wxCountry;

    private String wxProvince;

    private String wxCity;

    @JsonIgnore
    private Date createTime;

    @JsonIgnore
    private Boolean isDelete;

    private String personnelId;

    private String personnelName;

    @JsonIgnore
    private Boolean personnelIsDelete;

    private String tenantId;

    private String tenantName;

    private Date tenantStartDate;

    private Date tenantEndDate;

    @JsonIgnore
    private Boolean tenantIsDelete;

    private String appId;

    private String appName;

    @JsonIgnore
    private String appManagerUserId;

    @JsonIgnore
    private Boolean appIsDelete;

    private String entId;

    private String entName;

    private Integer provinceId;
    private String provinceName;

    private Integer cityId;
    private String cityName;

    private Integer countyId;
    private String countyName;
    private IndustryTypeEnum industryType;

    @JsonIgnore
    private Boolean entIsDelete;

    private String deptId;

    private String deptName;

    @JsonIgnore
    private Boolean deptIsDelete;

    private List<TenantInfo> tenants;

    private List<String> homepageUrls;

    public static UserContext getInstance() {
        return SecurityUtils.getUserContent();
    }
}
